#include <bits/stdc++.h>
using namespace std;
struct Node {
	int v, pos;
} a[8005], orig[8005];
bool cmp(Node a, Node b) {
	return a.v < b.v;
}
int ans[8005];
int main() {
    freopen("sort.in", "r", stdin);
    freopen("sort.out", "w", stdout);
    int n, q, op, x, val;
    cin >> n >> q;
    for (int i=1; i<=n; i++) {
    	cin >> a[i].v;
    	a[i].pos = i;
    	orig[i].v = a[i].v;
    	orig[i].pos = i;
	}
	stable_sort(a+1, a+1+n, cmp);
	for (int i=1; i<=n; i++) {
		ans[a[i].pos] = i;
	}
	//for (int i=1; i<=n; i++) {
	//	cout << ans[i] << endl;
	//}
	for (int test=1; test<=q; test++) {
    	cin >> op;
    	if (op == 1) {
    		cin >> x >> val;
    		orig[x].v = val;
			for (int i=1; i<=n; i++) {
				a[i].v = orig[i].v;
				a[i].pos = orig[i].pos;
			}
			stable_sort(a+1, a+1+n, cmp);
			for (int i=1; i<=n; i++) {
				ans[a[i].pos] = i;
			}
			//for (int i=1; i<=n; i++) {
			//	cout << ans[i] << endl;
			//}
		}
		if (op == 2) {
    		cin >> x;
    		cout << ans[x] << endl;
		}
	}
    return 0;
}
